package qz_rpt

class WorkActualController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }

    def workActual(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]
        params.SYS_QUERY_NAME = 'workActual'
        def workActual = dynamicQueryService.queryForList(params)
        def tableHeadList =  []
        if(workActual.size()>0){
            tableHeadList =  workActual[0].keySet()
        }
        params.SYS_QUERY_NAME = 'workActualCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        params.SYS_QUERY_NAME = 'workActualpartPicNum'
        def workActualpartPicNum = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'workActualPartDescList'
        def workActualPartDescList = dynamicQueryService.queryForList(params)

        params.SYS_QUERY_NAME = 'workActualLotIdList'
        def workActualLotIdList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'workActualStepDescList'
        def workActualStepDescList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'workActualUserList'
        def workActualUserList = dynamicQueryService.queryForList(params)

        params.SYS_QUERY_NAME = 'workActualUserName'
        def workActualUserName = dynamicQueryService.queryForList(params)
        [totalCount:totalCount,tableHeadList:tableHeadList,workActual:workActual,
         pageSizeList:pageSizeList,pageSize:pageSize,woIdList:workActualLotIdList,lotIdList:workActualLotIdList,workActualStepDescList:workActualStepDescList,workActualUserList:workActualUserList,
         startno:params.startno?:'',endno:params.endno?:'',partPicNum:params.partPicNum?:'',startTime:params.startTime?:'',endTime:params.endTime?:'',
         lotId:params.lotId?:'',stepDesc:params.stepDesc?:'',workUser:params.workUser?:'',woId:params.woId?:'',workActualLotIdList:workActualLotIdList,
         partDesc:params.partDesc?:'',workActualpartPicNum:workActualpartPicNum,workActualPartDescList:workActualPartDescList,workActualUserName:workActualUserName,
         workUserName:params.workUserName?:'']
    }

}
